﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebEntities;
using com.subb.WebInfo;
using WebEntities.Models.WebInfo;
using com.subb.Tools.Pager;

namespace WebUI.Controllers
{
    public class JobsController : Controller
    {
        private const int RowCount = 30;

        public JobsController()
            : base()
        {
            ViewBag.ActMenu = "jobs";
        }

        public ActionResult Index(int id = 1)
        {
            int page = id < 1 ? 1 : id;
            int start = (page - 1) * RowCount;
            WI_JobsDAL jdal = new WI_JobsDAL();
            int ttlCount;
            List<WI_Jobs> joblist = jdal.GetAllJobs(start, RowCount, out ttlCount);
            PagedList<WI_Jobs> pglist = joblist.ToPagedList(page, RowCount, ttlCount);
            return View(pglist);
        }

        public ActionResult Wish()
        {
            int id = Extensions.CommonFn.GetContentID("WishId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }

        public ActionResult Details(int id)
        {
            WI_JobsDAL jdal = new WI_JobsDAL();
            WI_Jobs job = jdal.GetJob(id);
            return View(job);
        }
    }
}
